import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { HouseInfoVO, HouseInfoForm, HouseInfoQuery } from '@/api/business/houseInfo/types';

/**
 * 查询房屋列表
 * @param query
 * @returns {*}
 */

export const listHouseInfo = (query?: HouseInfoQuery): AxiosPromise<HouseInfoVO[]> => {
  return request({
    url: '/business/houseInfo/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询房屋详细
 * @param houseId
 */
export const getHouseInfo = (houseId: string | number): AxiosPromise<HouseInfoVO> => {
  return request({
    url: '/business/houseInfo/' + houseId,
    method: 'get'
  });
};

/**
 * 新增房屋
 * @param data
 */
export const addHouseInfo = (data: HouseInfoForm) => {
  return request({
    url: '/business/houseInfo',
    method: 'post',
    data: data
  });
};

/**
 * 修改房屋
 * @param data
 */
export const updateHouseInfo = (data: HouseInfoForm) => {
  return request({
    url: '/business/houseInfo',
    method: 'put',
    data: data
  });
};

/**
 * 删除房屋
 * @param houseId
 */
export const delHouseInfo = (houseId: string | number | Array<string | number>) => {
  return request({
    url: '/business/houseInfo/' + houseId,
    method: 'delete'
  });
};
